#include <iostream>

const int size = 10;

class ArrayQueue
{
public:
    ArrayQueue():front(0),rear(0){}

    //入队列
    void Push(int data)
    {
        if((rear+1)%size==front)
        {
            std::cout<<"队列满!\n";
            return;
        }
        queue[rear++] = data;
        rear %= size;
    }

    void Pop()
    {
        if(front == rear)
        {
            std::cout<<"队列空!\n";
            return;
        }
        front++;
        front %= size;
    }
    
    int* GetFront()
    {
        return &queue[front];
    }

    bool IsEmpty()
    {
        return front == rear;
    }


private:
    int queue[size];
    int front;//对头指针
    int rear; //队尾指针
};



int main()
{
    ArrayQueue q;
    for(int i = 0;i<10;i++)
    {
        q.Push(i+1);
    }

    while(!q.IsEmpty())
    {
        std::cout<<*q.GetFront()<<" ";
        q.Pop();
    }
    std::cout<<std::endl;

    return 0;
}
